package com.juzi.staticcodeblock;

import java.util.ArrayList;

public class Test {

    /**
        1、定义一个静态集合，这样这个集合只加载一个。因为“房间”只需要一副牌
     */
    public static ArrayList<String> cards = new ArrayList<>();

    /**
        2、在程序真正运行main方法前，把54张牌放进去，后续游戏可以直接使用
     */
    static {
        //3、正式做牌，放到集合中
        //a、定义一个数组，存储全部点数，类型确定，个数确定
        String[] sizes = {"2","3","4","5","6","7","8","9","10","J","Q","K","A"};
        //b、定义一个数组，存储全部花色
        String[] colors = {"♥","♣","♦","♠"};
        //c、遍历点数
        for (int i = 0; i < sizes.length; i++) {
            //sizes[i]
            //d、遍历花色
            for (int j = 0; j < colors.length; j++) {
                //colors[j]
                String card = colors[j] + sizes[i];
                cards.add(card);
            }
        }
        //e、单独加入大小王
        cards.add("大🃏");
        cards.add("小🃏");

        System.out.println("新牌" + cards);

    }

    public static void main(String[] args) {
        //目标：模拟斗地主游戏启动前，初始化54张牌数据
    }
}
